﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Drawing;

namespace Skimpt3
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        Camera camWindow = null;
        Upload uploadWindow = null;

        public Window1()
        {
            InitializeComponent();
        }

        private void btnTakeShot_Click(object sender, RoutedEventArgs e)
        {
            camWindow = new Camera();
            camWindow.Show();
        }

        private void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (camWindow != null)
            {
                camWindow.Close();
            }

            if (uploadWindow != null)
            {
                uploadWindow.Close();
            }
        }

        private void btnScreenShot_Click(object sender, RoutedEventArgs e)
        {
            this.Hide();
            Bitmap bitmap;
            bitmap = ScreenCapture.GetDesktopWindowCaptureAsBitmap();

            this.Show();
            uploadWindow = new Upload();
            uploadWindow.img = bitmap;
            uploadWindow.Show();
        }
    }
}
